<!DOCTYPE html>
<html lang="en">

<head>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>监控中心 - 修改密码</title>

    <!-- Bootstrap Core CSS -->
    <link href="${request.getContextPath()}/public/vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">

    <!-- MetisMenu CSS -->
    <link href="${request.getContextPath()}/public/vendor/metisMenu/metisMenu.min.css" rel="stylesheet">

    <!-- Custom CSS -->
    <link href="${request.getContextPath()}/public/dist/css/sb-admin-2.css" rel="stylesheet">

    <!-- Custom Fonts -->
    <link href="${request.getContextPath()}/public/vendor/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
        <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->

</head>

<body>

    <div id="wrapper">

        <!--嵌入头部跟菜单-->
        <#include "/admin/inc/menu.html"/>

        <!-- Page Content -->
        <div id="page-wrapper">
            <div class="container-fluid">

                <div class="row">
            <div class="col-lg-12">
                <h4 class="page-header">修改密码</h4>
            </div>
            <!-- /.col-lg-12 -->
        </div>
        <!-- /.row -->
        <div class="row">
            <div class="col-lg-1"></div>
            <div class="col-lg-6">
                <form role="form" method="post" action="${request.getContextPath()}/admin/submitAlertPwd.do" onsubmit="return checkFormValue(this)">
                    
                    <div class="form-group">
                        <label>原密码</label>
                        <input class="form-control" name="password" type="password" required autofocus>
                        <p class="help-block">请输入6-12位登录密码.</p>
                    </div>


                    <div class="form-group">
                        <label>新密码</label>
                        <input class="form-control" name="newPassword" type="password" required>
                        <p class="help-block">请输入新的登录密码.</p>
                    </div>

                    <div class="form-group">
                        <label>重复新密码</label>
                        <input class="form-control" name="rePassword" type="password" required>
                        <p class="help-block">请重复输入您的的登录密码.</p>
                    </div>

                    <button type="submit" class="btn btn-success">提交</button>
                    <button type="reset" class="btn btn-warning" id="reset">重置</button>
                </form>
            </div>
        </div>
        <!-- /.row -->
                
                <!-- /.row -->
            </div>
            <!-- /.container-fluid -->
        </div>
        <!-- /#page-wrapper -->

    </div>
    <!-- /#wrapper -->

    <!-- jQuery -->
    <script src="${request.getContextPath()}/public/vendor/jquery/jquery.min.js"></script>

    <!-- Bootstrap Core JavaScript -->
    <script src="${request.getContextPath()}/public/vendor/bootstrap/js/bootstrap.min.js"></script>

    <!-- Metis Menu Plugin JavaScript -->
    <script src="${request.getContextPath()}/public/vendor/metisMenu/metisMenu.min.js"></script>

    <!-- Custom Theme JavaScript -->
    <script src="${request.getContextPath()}/public/dist/js/sb-admin-2.js"></script>

    <script>

        function checkFormValue(form){

            //检查密码长度（6-12 位）
            var password = form.password.value;

            if(password.length<6 || password.length>12){

                alert("密码长度为 6-12 位");

                return false;
            }

            var newPassword = form.newPassword.value;

            if(newPassword.length<6 || newPassword.length>12){

                alert("新密码长度为 6-12 位");

                return false;
            }

            //检查2次密码是否一样
            if(form.newPassword.value!=form.rePassword.value){

                alert("两次输入的密码不同");

                return false;
            }

            //提交数据
            $.post(form.action,{password:password,newPassword:newPassword},function(data){

                alert(data.msg);
                $("#reset").click();

            },"json");


            return false;
        }



    </script>

</body>

</html>
